/*
 *      main_notebook.cpp
 *      
 *      Copyright 2009 AzureSky <AzureSky.fedora@gmail.com>
 *      
 *      This program is free software; you can redistribute it and/or modify
 *      it under the terms of the GNU General Public License as published by
 *      the Free Software Foundation; either version 2 of the License, or
 *      (at your option) any later version.
 *      
 *      This program is distributed in the hope that it will be useful,
 *      but WITHOUT ANY WARRANTY; without even the implied warranty of
 *      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *      GNU General Public License for more details.
 *      
 *      You should have received a copy of the GNU General Public License
 *      along with this program; if not, write to the Free Software
 *      Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 *      MA 02110-1301, USA.
 */

#include "main_notebook.h"

main_notebook::main_notebook(BaseObjectType* cobject, const Glib::RefPtr<Gtk::Builder>& refGlade):
	Gtk::Notebook(cobject),
	refXml(refGlade)
{
	init_notebook();
}

main_notebook::~main_notebook()
{
}

void main_notebook::init_notebook()
{
	base_info();
	gconf_info();
	net_info();
	proc_info();
}

void main_notebook::base_info()
{
	refXml -> get_widget("hostname",host_name);
	host_name -> set_text(my_system.get_host_name());

	refXml -> get_widget("distname",dist_name);
	dist_name -> set_text(my_system.get_dist_name());

	refXml -> get_widget("kernel",kernel_name);
	kernel_name -> set_text(my_system.get_sys_name() +" "+ my_system.get_kernel_release());

	refXml -> get_widget("cpu_name",cpu_name);
	cpu_name -> set_text(my_system.get_cpu());

	refXml -> get_widget("mem_info",mem_total);
	mem_total -> set_text(my_system.get_total_memory());
}

void main_notebook::net_info()
{
	refXml -> get_widget_derived("net_connect",net_con);

	Glib::signal_timeout().connect(sigc::mem_fun(*this,&main_notebook::net_refresh),5000);
}

void main_notebook::proc_info()
{
	refXml -> get_widget_derived("proc_connect",proc_con);

	Glib::signal_timeout().connect(sigc::mem_fun(*this,&main_notebook::proc_refresh),5000);
}

void main_notebook::gconf_info()
{
	refXml -> get_widget_derived("gconf_notebook",gconf_page);
}

void main_notebook::about_info()
{
}

bool main_notebook::net_refresh()
{
	net_con -> net_refresh();
	return true;
}

bool main_notebook::proc_refresh()
{
	proc_con -> proc_refresh();
	return true;
}
